package ua.pp.parkee.t5;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Pavlo_Klivak on 8/19/2014.
 */
public class Account {

    private Integer amount;
    private Lock lock;

    public Account(int amount) {
        this.amount = amount;
        lock = new ReentrantLock();

    }


    public void withdraw(int amount) {
        if (amount <= 0) return;
        if (amount > this.amount) return;
        this.amount -= amount;
    }

    public void deposit(int amount) {
        if (amount <= 0) return;
        this.amount += amount;
    }

    public Integer getAmount() {
        return amount;
    }

    public Lock getLock() {
        return lock;
    }
}
